/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Com.MakeReport_Case;

import Com.Entity.TransaksiGedung;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Yosefina
 */
public class DailyReportGedungTableModel extends AbstractTableModel {

    private List<TransaksiGedung> transaksi = new ArrayList<TransaksiGedung>();

    public DailyReportGedungTableModel(List<TransaksiGedung> transaksi) {
        this.transaksi = transaksi;
    }

    @Override
    public int getRowCount() {
        return transaksi.size();
    }

    @Override
    public int getColumnCount() {
        return 6;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        TransaksiGedung gedung = transaksi.get(rowIndex);
        NumberFormat number = NumberFormat.getCurrencyInstance();
        switch (columnIndex) {
            case 0:
                return gedung.getNo_sewa();
            case 1:
                return gedung.getTanggalSewa();
            case 2:
                return gedung.getJenisGedung();
            case 3:
                return gedung.getJamSewa();
            case 4:
                return gedung.getJamKeluar();
            case 5:
                return number.format(gedung.getTotalHarga());
            default:
                return "";
        }
    }

    @Override
    public String getColumnName(int column) {
        switch (column) {
            case 0:
                return "NO TRANSAKSI";
            case 1:
                return "TANGGAL SEWA";
            case 2:
                return "JENIS GEDUNG";
            case 3:
                return "JAM SEWA";
            case 4:
                return "JAM KELUAR";
            case 5:
                return "TOTAL TAGIHAN";
            default:
                return "";
        }
    }
}
